package com.itheima.demo1;

public interface Eatable {
    void eat();
}


class EatableImple implements Eatable {

    @Override
    public void eat() {
        System.out.println("Eatable接口实现类中的eat方法");
    }
}
class test {
    public static void main(String[] args) {
        useEatable(new Eatable() {
            @Override
            public void eat() {
                System.out.println("匿名内部类中的eat方法");
            }
        });


        useEatable(() -> { System.out.println("Lambda中的eat方法执行");});
        EatableImple eatableImple = new EatableImple();
        useEatable(eatableImple);
        eatableImple.eat();
    }

    public static void useEatable(Eatable eatable){//Eatable eatable = eatableImple;
                                                   //eatableImple = new EatableImple;
                                                   //Eatable eatable =
        eatable.eat();
    }
}